﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ROMAP.Utilities
{
    public class Vector2i
    {
        #region Fields
        private int[] _vec;

        #endregion

        #region Properties

        public int X
        {
            get { return _vec[0]; }
            set { _vec[0] = value; }
        }

        public int Y
        {
            get { return _vec[1]; }
            set { _vec[1] = value; }
        }

        #endregion

        #region Constructors

        public Vector2i()
        {
            _vec = new int[2];
            _vec[0] = 0;
            _vec[1] = 0;
        }

        public Vector2i(int x, int y)
        {
            _vec = new int[2];
            _vec[0] = x;
            _vec[1] = y;
        }

        #endregion

        #region Methods

        public override bool Equals(Object o)
        {
            if (o is Vector2i)
            {
                Vector2i v = (Vector2i)o;
                return (v.X == this.X) && (v.Y == this.Y);
            }
            else
            {
                return false;
            }
        }

        public bool Equals(Vector2i v)
        {
            return (v.X == this.X) && (v.Y == this.Y);
        }

        public override int GetHashCode()
        {
            if (X < 0 || Y < 0)
            {
                return 0;
            }
            string temp = X.ToString() + "" + Y.ToString();
            return int.Parse(temp);
        }

        #endregion

    }
}
